library(tidyverse)
library(sf)
library(tmap)
library(plotly)
library(readxl)
library(leaflet)
library(ggrepel)
library(scales)
getwd()
[1] "C:/Users/Greg_Dills/Desktop/School/Data_Visualization/Data_Viz_Project_2/Data_Viz_Pro2/report"
fl_lakes <- read_sf("C:/Users/Greg_Dills/Desktop/School/Data_Visualization/Data_Viz_Project_2/Data_Viz_Pro2/data/Florida_Lakes/Florida_Lakes/Florida_Lakes.shp")
# Successfully read the lake shapefile
head(fl_lakes)
Simple feature collection with 6 features and 6 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: -87.42774 ymin: 27.46449 xmax: -81.34026 ymax: 30.74159
geographic CRS: WGS 84
# Trying to better understand the data in the .zip file. Neat to see a dbf file type and what it consists of (similar to the shapefile in this case)
library(foreign)
package 㤼㸱foreign㤼㸲 was built under R version 4.0.3
read.dbf("C:/Users/Greg_Dills/Desktop/School/Data_Visualization/Data_Viz_Project_2/Data_Viz_Pro2/data/Florida_Lakes/Florida_Lakes/Florida_Lakes.dbf")
summary(fl_lakes)
PERIMETER NAME COUNTY OBJECTID
Min. : 55.4 Length:4243 Length:4243 Min. : 1
1st Qu.: 708.8 Class :character Class :character 1st Qu.:1062
Median : 1363.6 Mode :character Mode :character Median :2122
Mean : 3289.1 Mean :2122
3rd Qu.: 2736.2 3rd Qu.:3182
Max. :421800.0 Max. :4243
SHAPEAREA SHAPELEN geometry
Min. :1.840e+02 Min. : 55.4 MULTIPOLYGON :4243
1st Qu.:2.422e+04 1st Qu.: 708.8 epsg:4326 : 0
Median :7.776e+04 Median : 1363.6 +proj=long...: 0
Mean :1.045e+06 Mean : 3289.1
3rd Qu.:2.456e+05 3rd Qu.: 2736.2
Max. :1.296e+09 Max. :421800.0
fl_lakes %>%
filter(NAME == "Lake Okeechobee")
Simple feature collection with 1 feature and 6 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: -81.09693 ymin: 26.71642 xmax: -80.61112 ymax: 27.20728
geographic CRS: WGS 84
# Generated summary data by county (Lake count and average perimeter)
fl_lakes_summary <- fl_lakes %>%
group_by(COUNTY) %>%
summarize(Average_Perimeter = mean(PERIMETER), Total_Lakes = n())
`summarise()` ungrouping output (override with `.groups` argument)
head(fl_lakes_summary)
Simple feature collection with 6 features and 3 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: -86.00468 ymin: 25.97413 xmax: -80.09586 ymax: 30.55578
geographic CRS: WGS 84
#Reviewing the summary data, ensuring that it makes sense. Palm Beach does contain the largest lake (Lake Okeechobee), thus the average perimeter makes sense. However, I am not familiar with Monroe County and intend to explore further.
fl_lakes_summary %>%
arrange(desc(Average_Perimeter))
Simple feature collection with 67 features and 3 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: -87.42774 ymin: 25.02625 xmax: -80.03097 ymax: 31.00254
geographic CRS: WGS 84